//
//  MainViewController.m
//  InviteJob
//
//  Created by chirui on 2017/10/13.
//  Copyright © 2017年 Shui. All rights reserved.
//

#import "MainViewController.h"
#import "MainTableViewCell.h"
#import "ImageTextButton.h"
#import "WorkDetailsViewController.h"
#import "SearchWorkViewController.h"
#import "BuilsServerDetailsViewController.h"
#import "JobsChooseViewController.h"

@interface MainViewController ()<UITableViewDelegate,UITableViewDataSource,SDCycleScrollViewDelegate,UITextFieldDelegate,UIPickerViewDelegate,UIPickerViewDataSource>{
    
    UITableView * _tableView;
    UIView * searchView;
    NSArray * classArray;
    
    NSMutableArray * _dataArray;
    int _page;
    int _totailPage;
     NSString * codeStr;
    NSString *  classStr;
    
    NSMutableArray *_dataImage;
    NSMutableArray *_dataImageAll;
    
    UIButton * oneBtn;
    UIButton * twoBtn;
    UIButton * threeBtn;
    
    NSString * oneBtnStr;
    NSString * twoBtnStr;
    NSString * threeBtnStr;
    
    NSString * strCateId;// 传值cate_id
    NSString * strSalary; //
    NSString * educationStr; //学历
    NSString * workYearStr; //经验
}

@property (nonatomic, strong) ImageTextButton * areButton;

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    oneBtnStr = @"岗位";
    strCateId = @"";
    twoBtnStr = @"薪资";
    threeBtnStr = @"学历";
    educationStr = @"";
    workYearStr = @"";
    _page = 1;
    _dataArray  = @[].mutableCopy;
    _dataImage = @[].mutableCopy;
    _dataImageAll = @[].mutableCopy;
    codeStr = @"0";
    classStr= @"";
    
    
    
    self.view.backgroundColor =[UIColor whiteColor];
    [self creatTableView];
    [self creatSearchView];
    [self getLoadImage];
    [self getClassRequest];
    
    // picker
    self.pickerView = [[RegionPicker alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.pickerView.pickerView.dataSource = self;
    self.pickerView.pickerView.delegate = self;
    [self.pickerView.confirmButton addTarget:self action:@selector(regionSelectAction) forControlEvents:UIControlEventTouchUpInside];
    [self.pickerView setHidden:YES];
    
    UIWindow *window = [[UIApplication sharedApplication].delegate window];
    [window addSubview:self.pickerView];
    
    [self getMessageListData];
    
    
    // 岗位
    //注册通知(等待接收消息)
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(volue:) name:@"volue" object:nil];
}
-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark -- 获得岗位参数
-(void)volue:(NSNotification *)sender{
    [self hideNoDataView];
    oneBtnStr = sender.userInfo[@"cate_name"];
    strCateId = sender.userInfo[@"cate_id"];
    
    _page = 1;
    [self getMessageListData];
}
-(void)creatSearchView{
    
    self.areButton = [[ImageTextButton alloc] initWithFrame:CGRectMake(0, 0, 60,40)
                                                          image:[UIImage imageNamed:@"icon_nav_drop_down"]
                                                          title:@"  全 国"];
     [self.areButton addTarget:self action:@selector(chooseAreClick:) forControlEvents:UIControlEventTouchUpInside];
    self.areButton.buttonTitleWithImageAlignment = UIButtonTitleWithImageAlignmentRight;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.areButton];
    
    self.navigationItem.titleView= [SearchView creatSearchTextFieldForDelegate:self Placeholder:@"搜索关键词"];
}


-(void)chooseAreClick:(UIButton *)btn {
    
    if(!self.province) {
        
        NSString *jsonPath = [[NSBundle mainBundle]pathForResource:@"region" ofType:@"json"];
        NSData *jsonData = [[NSData alloc]initWithContentsOfFile:jsonPath];
        self.province = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:nil];
        self.city = self.province[0][@"city"];
        self.country = self.city[0][@"country"];
        self.mem_province = self.province[0][@"province_code"];
        self.mem_city = self.city[0][@"city_code"];
        self.mem_country = self.country[0][@"country_code"];
        [self.pickerView setHidden:NO];
        [self.pickerView.pickerView reloadAllComponents];
    }else {
        [self.pickerView setHidden:NO];
        [self.pickerView.pickerView reloadAllComponents];
    }
    
    
}


-(void)textFieldDidBeginEditing:(UITextField *)textField {
    
    [textField resignFirstResponder];
    SearchWorkViewController * search =[[SearchWorkViewController alloc]init];
    search.hidesBottomBarWhenPushed =YES;
    [self.navigationController pushViewController:search animated:YES];
}

-(void)creatTableView{
    
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-64-48) style:UITableViewStyleGrouped];
    _tableView.dataSource =self;
    _tableView.delegate =self;
    _tableView.backgroundColor = strColor(@"f6f6f6");
    [self.view addSubview:_tableView];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [_tableView registerNib:[UINib nibWithNibName:[MainTableViewCell reuseIdentifier] bundle:nil] forCellReuseIdentifier:[MainTableViewCell reuseIdentifier]];
    
    MJRefreshNormalHeader * header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        
        _page = 1;
        [self getLoadImage];
        [self getMessageListData];
        
    }];
    _tableView.mj_header = header;
    
    MJRefreshAutoNormalFooter *  footer =[MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        
        _page ++;
        [self getMessageListData];
        
    }];
    
    footer.automaticallyRefresh = YES;
    _tableView.mj_footer =footer;
    
    if (_dataArray.count>10) {
        _tableView.mj_footer.hidden = NO;
    }else{
        _tableView.mj_footer.hidden = YES;
    }
    
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return _dataArray.count;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 130;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 210;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{

    return 0.01;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    NSDictionary * dic = _dataArray[indexPath.row];
    MainTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:[MainTableViewCell reuseIdentifier] forIndexPath:indexPath];
    cell.workName.text = dic[@"cate_name"];
    cell.details.text = [NSString stringWithFormat:@"%@%@  %@  %@",dic[@"city_name"],dic[@"county_name"],dic[@"work_experience"],dic[@"education"]];
    cell.priceLabel.text = dic[@"salary"];
    cell.timeLabel.text = dic[@"update_time"];
    cell.companyName.text = dic[@"company_name"];
    cell.peopleNumber.text = dic[@"staff_number"];
    cell.tagLabel.text = dic[@"com_type"];
    cell.companyName.numberOfLines = 1;
    [cell.companyName sizeToFit];
    
     cell.tagLabel.frame = CGRectMake(CGRectGetMaxX(cell.companyName.frame)+5, CGRectGetMinY(cell.companyName.frame)+2, 30, 15);
    
    [cell.companyImage sd_setImageWithURL:ImageUrl(dic[@"company_logo"]) placeholderImage:ImageName(@"")];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    NSDictionary * dic = _dataArray[indexPath.row];
    WorkDetailsViewController * work =[[WorkDetailsViewController alloc]init];
    work.hidesBottomBarWhenPushed = YES;
    work.workIdStr=dic[@"zp_id"];
    [self.navigationController pushViewController:work animated:YES];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    
    UIView * heardView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 350)];
    heardView.backgroundColor =strColor(@"f6f6f6");
    
   
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0,0, WIDTH, 160) delegate:self placeholderImage:[UIImage imageNamed:@"moren_banner_image"]];
    cycleScrollView.backgroundColor =Color(229, 229, 229);
    cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;
    cycleScrollView.currentPageDotColor = NavBackColor;
    [heardView addSubview:cycleScrollView];
    cycleScrollView.localizationImageNamesGroup = _dataImage;
    cycleScrollView.clickItemOperationBlock = ^(NSInteger index) {
        //岗位详情
        if ([_dataImageAll[index][@"type"] intValue] == 1) {
            WorkDetailsViewController * work =[[WorkDetailsViewController alloc]init];
            work.hidesBottomBarWhenPushed = YES;
            work.workIdStr=_dataImageAll[index][@"link"];
            [self.navigationController pushViewController:work animated:YES];
            return ;
        }
        
        if ([_dataImageAll[index][@"type"] intValue] == 2) {
            BuilsServerDetailsViewController * details =[[BuilsServerDetailsViewController alloc]init];
            details.hidesBottomBarWhenPushed = YES;
            details.severID=_dataImageAll[index][@"link"];
            [self.navigationController pushViewController:details animated:YES];
            return;
        }
    };
    UIView * titleView =[[UIView alloc]initWithFrame:CGRectMake(0, 160,  self.view.frame.size.width, 50)];
    titleView.backgroundColor = [UIColor whiteColor];
    [heardView addSubview:titleView];
    
    UIView * lineView =[[UIView alloc]initWithFrame:CGRectMake(0, 49, WIDTH, 0.5)];
    lineView.backgroundColor = strColor(@"f6f6f6");
    [titleView addSubview:lineView];
    
    
    oneBtn = [self creatTitleBtnView:CGRectMake(0, 0, WIDTH/3, 45) andBtnTitleStr:oneBtnStr andSel:@selector(oneBtnClick:) andLineColor:strColor(@"f6f6f6") onView:titleView];
    twoBtn = [self creatTitleBtnView:CGRectMake(WIDTH/3, 0, WIDTH/3, 45) andBtnTitleStr:twoBtnStr andSel:@selector(twoBtnClick:) andLineColor:strColor(@"f6f6f6") onView:titleView];
    threeBtn = [self creatTitleBtnView:CGRectMake(WIDTH/3*2, 0, WIDTH/3, 45) andBtnTitleStr:threeBtnStr andSel:@selector(threeBtnClick:)andLineColor:[UIColor clearColor] onView:titleView];
//    CGFloat imageWide = 60;
//    CGFloat gapWide = (WIDTH - 60*4)/5;
    
//    UIView * classView =[[UIView alloc]initWithFrame:CGRectMake(0, 160, WIDTH, 180)];
//    classView.backgroundColor = [UIColor whiteColor];
//    [heardView addSubview:classView];
//    UIButton *btn;
//    if (classArray.count>0) {
//        
//        for (int i = 0; i < classArray.count; i++) {
//            
//            NSDictionary * dic = classArray[i];
//            
//            btn = [UIButton buttonWithType:UIButtonTypeCustom];
//            
//            btn.frame = CGRectMake(gapWide+gapWide*(i%4)+imageWide*(i % 4), 10+10 *(i/4)+(imageWide+15)*(i/4) , imageWide, imageWide);
//            btn.tag = 100 + i;
//            btn.layer.cornerRadius = 30.f;
//            btn.layer.masksToBounds = YES;
//            
//            [btn sd_setBackgroundImageWithURL:ImageUrl(dic[@"img_str"]) forState:UIControlStateNormal placeholderImage:ImageName(@"icon_home_menu_architect")];
//             btn.backgroundColor =[UIColor whiteColor];
//            [btn addTarget:self action:@selector(ClassBtnClick:) forControlEvents:UIControlEventTouchUpInside];
//            [classView addSubview:btn];
//            
//            UILabel *label = [[UILabel alloc]init];
//            label.center = CGPointMake(btn.center.x, btn.center.y + imageWide / 2.f +10);
//            label.bounds = CGRectMake(0, 0, 100, 13);
//            label.font = [UIFont systemFontOfSize:13];
//            label.textColor = [UIColor blackColor];
//            label.textAlignment = NSTextAlignmentCenter;
//            label.text = dic[@"cate_name"];
//            [classView addSubview:label];
//        }
//    
//        classView.frame = CGRectMake(0, 160, WIDTH, CGRectGetMaxY(btn.frame)+30);
//    }
//    heardView.frame = CGRectMake(0, 0, WIDTH, CGRectGetMaxY(classView.frame));
    
    return heardView;
}

-(void)oneBtnClick:(UIButton *)btn{
    
    JobsChooseViewController *jobs = [JobsChooseViewController new];
    jobs.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:jobs animated:YES];
    
}

-(void)twoBtnClick:(UIButton *)btn{
    
    NSArray * educationArray = @[@"2k以下", @"2k-5k", @"5k-10k", @"10k-15k", @"15k-25k"];
    zySheetPickerView * pickerView = [zySheetPickerView ZYSheetStringPickerWithTitle:educationArray andHeadTitle:@"薪资" Andcall:^(zySheetPickerView *pickerView, NSString *choiceString) {
        [twoBtn setTitle:choiceString forState:UIControlStateNormal];
        
        strSalary = choiceString;
        
        
        if ([choiceString isEqualToString:@"不限"]) {
            workYearStr = @"";
        }else{
            workYearStr = choiceString;
        }
        
        [pickerView dismissPicker];
        
        _page = 1;
        [self hideNoDataView];
        [self getMessageListData];
    }];
    [pickerView show];
    
}

-(void)threeBtnClick:(UIButton *)btn{
    
    NSArray * educationArray = @[@"不限",@"初中",@"高中",@"中专",@"大专",@"本科",@"博士",@"硕士"];
    zySheetPickerView * pickerView = [zySheetPickerView ZYSheetStringPickerWithTitle:educationArray andHeadTitle:@"学历" Andcall:^(zySheetPickerView *pickerView, NSString *choiceString) {
        [threeBtn setTitle:choiceString forState:UIControlStateNormal];
        
        threeBtnStr = choiceString;
        
        if ([choiceString isEqualToString:@"不限"]) {
            educationStr = @"";
        }else{
            educationStr = choiceString;
        }
        
        [pickerView dismissPicker];
        
        _page = 1;
        [self hideNoDataView];
        [self getMessageListData];
    }];
    [pickerView show];
    
}

-(void)ClassBtnClick:(UIButton *)btn{
    [self hideNoDataView];
    NSDictionary * dic = classArray[btn.tag-100];
    classStr = dic[@"cate_id"];
    
    _page = 1;
    [self getMessageListData];
    
}

#pragma mark -- 推荐岗位类型
-(void)getClassRequest{

    [PostNetWorking postNetWorkingStr:RequestUrlStr(main_classList_api) andparameters:nil Success:^(id responseObject) {
        SHuiMBHidleYes;
        if (codeSucess) {
            
            if ([responseObject[@"datas"] isKindOfClass:[NSArray class]]) {
                
                classArray = responseObject[@"datas"];
            }
            
        }else {
            
            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
        }
        [_tableView reloadData];
        
    } failed:^(NSError *error) {
        
        SHuiMBHidleYes;
        SHuiMBhudTextNetError;
    }];
}

#pragma mark -- 轮播图
-(void)getLoadImage{
    
    [PostNetWorking postNetWorkingStr:RequestUrlStr(getBanner_api) andparameters:@{@"sign_key":@"app-home"} Success:^(id responseObject) {
        SHuiMBHidleYes;
        if (codeSucess) {
            
            if ([responseObject[@"datas"] isKindOfClass:[NSArray class]]) {
                
                _dataImageAll = responseObject[@"datas"];
                
                for (NSDictionary *dic in responseObject[@"datas"]) {
                    [_dataImage addObject:dic[@"image"]];
                }
                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    [_tableView reloadData];
                });
            }
            
        }else {
            
            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
        }
        [_tableView reloadData];
        
    } failed:^(NSError *error) {
        
        SHuiMBHidleYes;
        SHuiMBhudTextNetError;
    }];
}

-(void)getMessageListData{
    
    if (_totailPage != 0) {
        if(_page == _totailPage + 1){
            [_tableView.mj_footer setState: MJRefreshStateNoMoreData];
            
            return ;
        }
    }
    
    NSDictionary * dic = @{
                           @"cate_id":classStr,
                           @"page":[NSString stringWithFormat:@"%d",_page],
                           @"perpage":@"10",
                           @"code":codeStr,
                           @"education":educationStr,
                           @"salary":workYearStr,
                           @"cate_name":strCateId
                           };
    
    SHuiMBhubNoTimeStr(@"正在加载...");
    [PostNetWorking postNetWorkingStr:RequestUrlStr(main_dataList_api) andparameters:dic Success:^(id responseObject) {
        SHuiMBHidleYes;
        if (codeSucess) {
            _totailPage = [responseObject[@"datas"][@"total_page"]  intValue];
            
            if (_page==1) {
                
                if (_dataArray) {
                    
                    [_dataArray removeAllObjects];
                }
                if ([responseObject[@"datas"][@"lists"]  isKindOfClass:[NSArray class]]) {
                    
                    for (NSDictionary * dic in responseObject[@"datas"][@"lists"]) {
                        
                        [_dataArray addObject:dic];
                    }
                }
            }else {
                
                if ([responseObject[@"datas"][@"lists"]  isKindOfClass:[NSArray class]]) {
                    
                    for (NSDictionary * dic in responseObject[@"datas"][@"lists"]) {
                        
                        [_dataArray addObject:dic];
                    }
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                
                
                if (_dataArray.count>0) {
                    [self hideNoDataView];
                    if (_dataArray.count<10) {
                        
                        _tableView.mj_footer.hidden = YES;
                    }else {
                        _tableView.mj_footer.hidden = NO;
                    }
                }else {
                    _tableView.mj_footer.hidden = YES;
                    [self shopNoDataViewBackgroundColor:[UIColor clearColor] withImage:@"img_home_no_news" withLabelMsg:@"没有任何数据" withButton:@"" isY:0];
                }
                [_tableView.mj_header endRefreshing];
                [_tableView.mj_footer endRefreshing];
                [_tableView reloadData];
                
            });
            
        }else {
            
            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
        }
        
    } failed:^(NSError *error) {
        SHuiMBHidleYes;
        SHuiMBhudTextTimeStr(@"网络错误请重试！");
    }];
    
    
}

// 区域选择确定
- (void)regionSelectAction {
    [self.pickerView setHidden:YES];
    
    if (self.selectedRegion.length==0) {
        
        codeStr = @"110101";
        [self.areButton setTitle:@"东城区" forState:UIControlStateNormal];
    }else{
        NSArray * array = [self.selectedRegion componentsSeparatedByString:@" "];
        
        NSString * are = [array lastObject];
        
        if (are.length>3) {
            
            are = [are  substringToIndex:3];
        }
        
        [self.areButton setTitle:are forState:UIControlStateNormal];
    }
    
    _page = 1;
    
    [self getMessageListData];
}

#pragma mark - UIPickerView datasource
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return 3;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
    switch (component) {
        case 0:
        {
            if(![self.province isKindOfClass:[NSNull class]]) {
                return self.province.count;
            }else {
                return 0;
            }
        }
            break;
        case 1:
        {
            if(![self.city isKindOfClass:[NSNull class]]) {
                return self.city.count;
            }else {
                return 0;
            }
        }
            break;
        case 2:
        {
            if(![self.country isKindOfClass:[NSNull class]]) {
                return self.country.count;
            }else {
                return 0;
            }
        }
            break;
        default:
            break;
    }
    return 0;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    switch (component) {
            
        case 0:
        {
            // 省份
            return self.province[row][@"simple_province_name"];
        }
            break;
        case 1:
        {
            // 城市
            return self.city[row][@"simple_city_name"];
        }
            break;
        case 2:
        {
            // 乡镇、街道
            return self.country[row][@"simple_country_name"];
        }
            break;
        default:
            break;
    }
    return nil;
}

#pragma mark - UIPickerView delegate
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    switch (component) {
        case 0:
        {
            // 省份
            self.city = self.province[row][@"city"];
            self.country = self.city[0][@"country"];
            [pickerView selectRow:0 inComponent:1 animated:NO];
            [self pickerView:self.pickerView.pickerView didSelectRow:0 inComponent:1];
        }
            break;
        case 1:
        {
            // 城市
            self.country = self.city[row][@"country"];
            [pickerView selectRow:0 inComponent:2 animated:NO];
            [self pickerView:self.pickerView.pickerView didSelectRow:0 inComponent:2];
        }
            break;
        case 2:
        {
            // 乡镇、街道
        }
            break;
        default:
            break;
    }
    
    self.mem_province = self.province[[pickerView selectedRowInComponent:0]][@"province_code"];
    self.selectedRegion = self.province[[pickerView selectedRowInComponent:0]][@"province_name"];
    
    
    self.mem_city = self.city[[pickerView selectedRowInComponent:1]][@"city_code"];
    self.selectedRegion = [self.selectedRegion stringByAppendingString:[NSString stringWithFormat:@" %@",self.city[[pickerView selectedRowInComponent:1]][@"city_name"]]];
    
    
    if([self.country isKindOfClass:[NSArray class]]) {
        self.mem_country = self.country[[pickerView selectedRowInComponent:2]][@"country_code"];
        
        self.selectedRegion = [self.selectedRegion stringByAppendingString:[NSString stringWithFormat:@" %@",self.country[[pickerView selectedRowInComponent:2]][@"country_name"]]];
        
    }else {
        self.mem_country = @"1";
    }
    
    codeStr = self.mem_country;
    
    [pickerView reloadAllComponents];
}


-(UIButton *)creatTitleBtnView:(CGRect)rec andBtnTitleStr:(NSString *)titleStr andSel:(SEL)sel andLineColor:(UIColor*)col onView:(UIView *)view {
    
    UIView *oneView =[[UIView alloc]initWithFrame:rec];
    oneView.backgroundColor =[UIColor whiteColor];
    
    UIButton *  classBtn =[UIButton buttonWithType:UIButtonTypeSystem];
    classBtn.frame = CGRectMake((WIDTH/3-80)/2-5, 5, 80, 40);
    [classBtn setTitle:titleStr forState:UIControlStateNormal];
    [classBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [classBtn addTarget:self action:sel forControlEvents:UIControlEventTouchUpInside];
    classBtn.titleLabel.font =[UIFont systemFontOfSize:15];
    [oneView addSubview:classBtn];
    UIImageView *  classImage =[[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(classBtn.frame), 19, 13, 13)];
    classImage.image =[UIImage imageNamed:@"icon_recruit_talents_drop_down_pre"];
    [oneView addSubview:classImage];
    
    UIView * oneline =[[UIView alloc]initWithFrame:CGRectMake(WIDTH/3-1, 17, 1, 15)];
    oneline.backgroundColor =col;
    [oneView addSubview:oneline];
    
    [view addSubview:oneView];
    return classBtn;
}
@end
